<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
<title>管理区域</title>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
</head>

<body>
<div style="background-color:#FFFFFF ">
  <form  method="post" action="ticket_subGenerate.html" >
  <table width="98%" border="0" align="center"  cellpadding="3" cellspacing="1" class="tableborder">
    <tr>
      <td class="left_title_2adminssd">产品</td>
      <td style="background-color:#FFFFFF"><select name="product_id" id="select">
      <?=$productOption?>
      </select></td>
      </tr>
   
       <tr>
          <td class="left_title_2adminssd">前缀</td>
          <td style="background-color:#FFFFFF"><input name="prefix" id="prefix" type="text"   value="" /></td>
      </tr>
        <tr>
          <td class="left_title_2adminssd">发放量(数字)</td>
          <td style="background-color:#FFFFFF">
          <input name="quantity" type="text"  id="quantity" value="" />
          </td>
         
      </tr>
      <tr>
          <td class="left_title_2adminssd">种子起始(数字)</td>
          <td style="background-color:#FFFFFF">
          <input name="startNumber" type="text" id="startNumber"  value=""/>
          </td>
      </tr>
      <tr>
          <td class="left_title_2adminssd">种子位数(数字)</td>
         <td style="background-color:#FFFFFF">
          <input name="numberDigits" type="text"  id="numberDigits"   value=""/>
          </td>
      </tr>
          <tr>
          <td class="left_title_2adminssd">后缀</td>
         <td style="background-color:#FFFFFF">
          <input name="suffix" type="text"    id="suffix"   value=""/>
          </td>
      </tr>
      <tr>
          <td class="left_title_2adminssd">随机位数(数字)</td>
         <td style="background-color:#FFFFFF">
          	<input name="randDigits" type="text"    id="randDigits"   value="" />
          </td>
      </tr>
        <tr>
      <td class="left_title_2adminssd">加密方法</td>
     <td style="background-color:#FFFFFF"><select name="cryptMethod" id="select">
       <option value="">不加密</option>
          <option  value="md5">算法1</option>
<option  value="sha1">算法2</option>
<option  value="hash">算法3</option>
      </select></td>
      </tr>
      <tr>
          <td class="left_title_2adminssd">密码长度</td>
         <td style="background-color:#FFFFFF"><select name="passwordLeng" >
            <option value="6">6</option>
          <option value="7">7</option>
          <option value="8">8</option>
          <option value="9">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
            <option value="12">12</option>
              <option value="13">13</option>
          </select></td>
      </tr>
         <tr>
          <td class="left_title_2adminssd">有效期</td>
         <td style="background-color:#FFFFFF">
          	<input name="valid_start_time" type="text" onClick="WdatePicker()" />--<input name="valid_end_time" type="text" onClick="WdatePicker()" />
          </td>
      </tr>
       <tr>
      <td class="left_title_2adminssd">样例</td>
         <td style="background-color:#FFFFFF">
          	<p id="p_ticket_sample">&nbsp;&nbsp;</p>
          </td>
      </tr>
       <tr style="background-color:#FFFFFF">
          <td colspan="2">&nbsp;</td>
      </tr>
      
    <tr style="background-color:#FFFFFF">
      <td colspan="2" align="center" >
        <input name="input" type="button" class="PublicBot" value="返回" onclick="location.href='ticket_lists.html'" />
        &nbsp;&nbsp;&nbsp;
        <input class="PublicBot" name="" type="submit" value="提交" /></td>
    </tr>
  </table>
</form>
</div>
<script>
$(":input").change(function(){
	var prefix = $("#prefix").val(); 
	var quantity = $("#quantity").val(); 
	var startNumber = $("#startNumber").val(); 
	var numberDigits = $("#numberDigits").val(); 
	var suffix = $("#suffix").val(); 
	var randDigits = $("#randDigits").val(); 

	var startNumber_length = startNumber.length;
	var zeroNumber_length = parseInt(numberDigits)-startNumber_length;
	var endNumber= parseInt(startNumber)+parseInt(quantity)-1;
	var endNumberStr = endNumber+"";
	var endZeroNumber_length = parseInt(numberDigits)-endNumberStr.length;

	var startZeroStr ="";
	for(i=0;i<zeroNumber_length;i++){
		startZeroStr=startZeroStr+"0";
	}
	var endZeroStr ="";
	for(i=0;i<endZeroNumber_length;i++){
		endZeroStr=endZeroStr+"0";
	}
	
	var randStr = "";
	for(j=0;j<randDigits;j++){
		randStr = randStr+"#";
	}

	var ticket_start = prefix+startZeroStr+startNumber+suffix+randStr;
	var ticket_end = prefix+endZeroStr+endNumber+suffix+randStr;
	var p_ticket_sample = ticket_start+"-"+ticket_end;
	$("#p_ticket_sample").html(p_ticket_sample);
})
</script>
</body>
</html>
